package com.csjy.migration.hnnd.workflow;

import com.csjy.migration.hnnd.DbUtil;
import com.csjy.migration.hnnd.ProgramArgument;
import com.csjy.migration.hnnd.annotation.Task;
import com.csjy.migration.hnnd.business.SourceBusinessData;

import java.util.List;
import java.util.Map;

/**
 * 项目终结流程
 */
public class ItemRefundRelieveHny extends WorkflowMigration {

    public ItemRefundRelieveHny(DbUtil sourceDbUtil, DbUtil targetDbUtil, SourceBusinessData sourceData, ProgramArgument programArgument, String projectId, String procInstId, Map procInstRow) throws Exception {
        super(sourceDbUtil, targetDbUtil, sourceData, programArgument, projectId, procInstId, procInstRow);
        this.customInitData();
    }

    @Override
    public void customInitData() throws Exception {
        this.curBizType = "xmzj";
    }

    @Override
    public void customInsertOrUpdateData() throws Exception {

    }

    @Task("项目终结流程@项目经理提交申请")
    public void xuzjlcxmjltjsq() throws Exception {
        this.curAffixType = "jbhj";

        this.curModelMap.put("all", new String[]{"task1536113359730tjsh","提交审核"});
        // recede_bail_1 保证金
        // recede_fare_1 担保费

        this.curCustomData.put("customerRefund",this.getJbpmVarInstValueByName("recede_bail_1"));
        this.curCustomData.put("returnGuaranteeFee",this.getJbpmVarInstValueByName("recede_fare_1"));

        this.setCommonData(true,null);
    }

    @Task("项目终结流程@BC经理审核")
    public void xuzjlcBCjlsh() throws Exception {

        this.curModelMap.put("同意", new String[]{"task1536113360866ty","同意"});
        this.curModelMap.put("不同意", new String[]{"endbty","不同意"});

        this.setCommonData(false,null);
    }

    @Task("项目终结流程@风控副经理审核")
    public void xuzjlcfkfjlsh() throws Exception {
        this.curModelMap.put("同意", new String[]{"task1536113362418ty","同意"});
        this.curModelMap.put("不同意", new String[]{"endbty","不同意"});

        this.setCommonData(true,null);
    }

    @Task("项目终结流程@风控经理审核")
    public void xuzjlcfkjlsh() throws Exception {
        this.xuzjlcfkfjlsh();
    }

    @Task("项目终结流程@财务部经理审核")
    public void xuzjlccwbjlsh() throws Exception {

        this.curModelMap.put("同意", new String[]{"task1536113364257ty","同意"});
        this.curModelMap.put("不同意", new String[]{"endbty","不同意"});

        this.setCommonData(true,null);
    }

    @Task("项目终结流程@总经理审核")
    public void xuzjlczjlsh() throws Exception {

        this.curModelMap.put("同意", new String[]{"task1536113365906ty","同意"});
        // 旧系统通过 直接走到财务相关节点，暂时都给到这个节点上
        this.curModelMap.put("通过",  new String[]{"task1536113365906ty","同意"});
        this.curModelMap.put("不同意", new String[]{"endbty","不同意"});

        this.setCommonData(true,null);
    }

    @Task("项目终结流程@董事长审核")
    public void xmzjlcdszsh() throws Exception {

        this.curModelMap.put("同意", new String[]{"exclusiveGateway1536115204828ty","同意"});
        this.curModelMap.put("不同意", new String[]{"endbty","不同意"});

        this.setCommonData(true,null);
    }

    @Task("项目终结流程@档案室退权证和财务处退保证金")
    public void xuzjlcdastqzhcwctbzj() throws Exception {

        this.curCustomData.put("customerRefund",this.getJbpmVarInstValueByName("recede_bail"));//保证金
        this.curCustomData.put("returnGuaranteeFee",this.getJbpmVarInstValueByName("recede_fare"));//担保费


        this.curCustomData.put("bankRefund",this.getJbpmVarInstValueByName("bank_recede"));//银行退保证金
        this.curCustomData.put("projectProfitSettlement",this.getJbpmVarInstValueByName("item_result"));//项目利润结算

        this.curModelMap.put("all",new String[]{"parallelGateway1536113501921js","结束"});

        this.setCommonData(true,null);
    }
}
